home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / firefox < prev    next >
Text File  |  2006-05-08  |  5KB  |  191 lines

  1. #!/bin/sh
  2. #
  3. # ***** BEGIN LICENSE BLOCK *****
  4. # Version: MPL 1.1/GPL 2.0/LGPL 2.1
  5. #
  6. # The contents of this file are subject to the Mozilla Public License Version
  7. # 1.1 (the "License"); you may not use this file except in compliance with
  8. # the License. You may obtain a copy of the License at
  9. # http://www.mozilla.org/MPL/
  10. #
  11. # Software distributed under the License is distributed on an "AS IS" basis,
  12. # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  13. # for the specific language governing rights and limitations under the
  14. # License.
  15. #
  16. # The Original Code is mozilla.org Code.
  17. #
  18. # The Initial Developer of the Original Code is
  19. # Netscape Communications Corporation.
  20. # Portions created by the Initial Developer are Copyright (C) 1998
  21. # the Initial Developer. All Rights Reserved.
  22. #
  23. # Contributor(s):
  24. #
  25. # Alternatively, the contents of this file may be used under the terms of
  26. # either the GNU General Public License Version 2 or later (the "GPL"), or
  27. # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  28. # in which case the provisions of the GPL or the LGPL are applicable instead
  29. # of those above. If you wish to allow use of your version of this file only
  30. # under the terms of either the GPL or the LGPL, and not to allow others to
  31. # use your version of this file under the terms of the MPL, indicate your
  32. # decision by deleting the provisions above and replace them with the notice
  33. # and other provisions required by the GPL or the LGPL. If you do not delete
  34. # the provisions above, a recipient may use your version of this file under
  35. # the terms of any one of the MPL, the GPL or the LGPL.
  36. #
  37. # ***** END LICENSE BLOCK *****
  38.  
  39. ## $Id: mozilla.in,v 1.12.8.1 2005/09/20 21:13:03 dbaron%dbaron.org Exp $
  40. ## 
  41. ## Usage:
  42. ##
  43. ## $ mozilla [args]
  44. ##
  45. ## This script is meant to run the mozilla-bin binary from either 
  46. ## mozilla/xpfe/bootstrap or mozilla/dist/bin.
  47. ##
  48. ## The script will setup all the environment voodoo needed to make
  49. ## the mozilla-bin binary to work.
  50. ##
  51.  
  52. moz_pis_startstop_scripts()
  53. {
  54.   MOZ_USER_DIR=".mozilla/firefox"
  55.   # MOZ_PIS_ is the name space for "Mozilla Plugable Init Scripts"
  56.   # These variables and there meaning are specified in
  57.   # mozilla/xpfe/bootstrap/init.d/README
  58.   MOZ_PIS_API=2
  59.   MOZ_PIS_MOZBINDIR="${dist_bin}"
  60.   MOZ_PIS_SESSION_PID="$$"
  61.   MOZ_PIS_USER_DIR="${MOZ_USER_DIR}"
  62.   export MOZ_PIS_API MOZ_PIS_MOZBINDIR MOZ_PIS_SESSION_PID MOZ_PIS_USER_DIR
  63.   
  64.   case "${1}" in
  65.     "start")
  66.       for curr_pis in "${dist_bin}/init.d"/S* "${HOME}/${MOZ_USER_DIR}/init.d"/S* ; do
  67.         if [ -x "${curr_pis}" ] ; then
  68.           case "${curr_pis}" in
  69.             *.sh) .  "${curr_pis}"         ;;
  70.             *)       "${curr_pis}" "start" ;;
  71.           esac
  72.         fi
  73.       done
  74.       ;;
  75.     "stop")
  76.       for curr_pis in "${HOME}/${MOZ_USER_DIR}/init.d"/K* "${dist_bin}/init.d"/K* ; do
  77.         if [ -x "${curr_pis}" ] ; then
  78.           case "${curr_pis}" in
  79.             *.sh) . "${curr_pis}"        ;;
  80.             *)      "${curr_pis}" "stop" ;;
  81.           esac
  82.         fi
  83.       done
  84.       ;;
  85.     *)
  86.       echo 1>&2 "$0: Internal error in moz_pis_startstop_scripts."
  87.       exit 1
  88.       ;;
  89.   esac
  90. }
  91.  
  92. #uncomment for debugging
  93. #set -x
  94.  
  95. moz_libdir=/usr/lib/mozilla-firefox
  96. MRE_HOME=/usr/lib/mre/mre-1.5.0.3
  97.  
  98. # Use run-mozilla.sh in the current dir if it exists
  99. # If not, then start resolving symlinks until we find run-mozilla.sh
  100. found=0
  101. progname="$0"
  102. curdir=`dirname "$progname"`
  103. progbase=`basename "$progname"`
  104. run_moz="$curdir/run-mozilla.sh"
  105. if test -x "$run_moz"; then
  106.   dist_bin="$curdir"
  107.   found=1
  108. else
  109.   here=`/bin/pwd`
  110.   while [ -h "$progname" ]; do
  111.     bn=`basename "$progname"`
  112.     cd `dirname "$progname"`
  113.     progname=`/bin/ls -l "$bn" | sed -e 's/^.* -> //' `
  114.     if [ ! -x "$progname" ]; then
  115.       break
  116.     fi
  117.     curdir=`dirname "$progname"`
  118.     run_moz="$curdir/run-mozilla.sh"
  119.     if [ -x "$run_moz" ]; then
  120.       cd "$curdir"
  121.       dist_bin=`pwd`
  122.       run_moz="$dist_bin/run-mozilla.sh"
  123.       found=1
  124.       break
  125.     fi
  126.   done
  127.   cd "$here"
  128. fi
  129. if [ $found = 0 ]; then
  130.   # Check default compile-time libdir
  131.   if [ -x "$moz_libdir/run-mozilla.sh" ]; then
  132.     dist_bin="$moz_libdir"
  133.   else 
  134.     echo "Cannot find mozilla runtime directory. Exiting."
  135.     exit 1
  136.   fi
  137. fi
  138.  
  139. script_args=""
  140. debugging=0
  141. MOZILLA_BIN="${progbase}-bin"
  142.  
  143. if [ "$OSTYPE" = "beos" ]; then
  144.   mimeset -F "$MOZILLA_BIN"
  145. fi
  146.  
  147. pass_arg_count=0
  148. while [ $# -gt $pass_arg_count ]
  149. do
  150.   case "$1" in
  151.     -p | --pure | -pure)
  152.       MOZILLA_BIN="${MOZILLA_BIN}.pure"
  153.       shift
  154.       ;;
  155.     -g | --debug)
  156.       script_args="$script_args -g"
  157.       debugging=1
  158.       shift
  159.       ;;
  160.     -d | --debugger)
  161.       script_args="$script_args -d $2"
  162.       shift 2
  163.       ;;
  164.     *)
  165.       # Move the unrecognized argument to the end of the list.
  166.       arg="$1"
  167.       shift
  168.       set -- "$@" "$arg"
  169.       pass_arg_count=`expr $pass_arg_count + 1`
  170.       ;;
  171.   esac
  172. done
  173.  
  174. export MRE_HOME
  175.  
  176. ## Start addon scripts
  177. moz_pis_startstop_scripts "start"
  178.  
  179. if [ $debugging = 1 ]
  180. then
  181.   echo $dist_bin/run-mozilla.sh $script_args $dist_bin/$MOZILLA_BIN "$@"
  182. fi
  183. "$dist_bin/run-mozilla.sh" $script_args "$dist_bin/$MOZILLA_BIN" "$@"
  184. exitcode=$?
  185.  
  186. ## Stop addon scripts
  187. moz_pis_startstop_scripts "stop"
  188.  
  189. exit $exitcode
  190. # EOF.
  191.